package com.xs.listener;

import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

import com.xs.entity.Person;
import com.xs.message.Reviever;
import com.xs.message.ShopChannel;

@Component
public class UserListener {
	@StreamListener(Sink.INPUT)
	public void handle(String body) {
		System.out.println("handle Received: " + body);
	}

	@StreamListener(Reviever.commentInfo)
	public void commentInfo(String body) {
		System.out.println("commentInfo Received: " + body);
	}

	@StreamListener(Reviever.orderInfo)
	public void orderInfo(String body) {
		System.out.println("orderInfo Received: " + body);
	}

	@StreamListener(Reviever.userInfo)
	public void userInfo(String body) {
		System.out.println("userInfo Received: " + body);
	}

	@StreamListener(ShopChannel.SHOP_INPUT)
	public void receive(Message<Person> message) {
		System.out.println(message.getPayload());
	}
}
